const { goodsTypeError } = require('../consisitant/err.type')
const validator = async (ctx, next) => {
    try {
        ctx.verifyParams({
            goods_name: { type: 'string', required: true },
            goods_price: { type: 'number', require: true },
            goods_num: { type: 'number', require: true },
            goods_img: { type: "string", require: true }
        })
        await next()
    } catch (err) {
        return ctx.app.emit('error', goodsTypeError, ctx)
    }
}

module.exports = {
    validator
}
